﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Main.Master" Inherits="System.Web.Mvc.ViewPage<Defect_Tracking_System.Helpers.PaginatedList<Defect_Tracking_System.Models.Account>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="page-heading">
	<h1>Account List</h1>
</div>
<!-- end page-heading -->
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
	<th rowspan="3" class="sized"><img src="/Content/images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
	<th class="topleft"></th>
	<td id="tbl-border-top">&nbsp;</td>
	<th class="topright"></th>
	<th rowspan="3" class="sized"><img src="/Content/images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
	<td id="tbl-border-left"></td>
	<td>
	<!--  start content-table-inner ...................................................................... START -->
	<div id="content-table-inner">
		<!--  start table-content  -->
		<div id="table-content">
            <%if (Session["Message"] != null)
              { %>
                <div id="message-red">
				    <table cellspacing="0" cellpadding="0" border="0" width="100%">
				    <tbody>
                        <tr>
					        <td class="red-left"><%: Session["Message"] %></td>
					        <td class="red-right"><a class="close-red"><img alt="" src="/Content/images/table/icon_close_red.gif"></a></td>
				        </tr>
				    </tbody>
                    </table>
				</div>
                <% 
                    Session.Remove("Message");
              } %>
			<table border="0" width="100%" cellpadding="0" cellspacing="0" class="product-table">
			<tr>
                <th class="table-header-repeat line-left"><a href="#">UserName</a></th>
				<th class="table-header-repeat line-left minwidth-1"><a href="#">First Name</a></th>
				<th class="table-header-repeat line-left"><a href="#">Last Name</a></th>
				<th class="table-header-repeat line-left"><a href="#">Address</a></th>
				<th class="table-header-repeat line-left"><a href="#">Email</a></th>
				<th class="table-header-repeat line-left"><a href="#">Role</a></th>
				<th class="table-header-repeat line-left"><a href="#">IsActive</a></th>
                <th class="table-header-repeat line-left"><a href="#">Options</a></th>
			</tr>
            <% foreach(Defect_Tracking_System.Models.Account account in Model){ %>
			<tr>
				<td><%: account.UserName %></td>
				<td><%: account.Profiles.FirstOrDefault().FirstName %></td>
                <td><%: account.Profiles.FirstOrDefault().LastName%></td>
				<td><%: account.Profiles.FirstOrDefault().Address %></td>
				<td><%: account.Profiles.FirstOrDefault().Email %></td>
				<td><%: account.Role %></td>
                <td>
                    <% if (account.IsActive)
                        { %>
                        <input type="checkbox" disabled="disabled" checked="checked" />
                    <%}
                        else
                        { %>
                        <input type="checkbox" disabled="disabled" />
                    <%} %>
                </td>
				<td class="options-width">             
                    <%: Html.ActionLink(" ","Details", new { UserName = account.UserName }, new {@class = "icon-6 info-tooltip", @title="View"}) %>
                    <% if(User.IsInRole("Group Admin")) 
                       { %>
                            <%: Html.ActionLink(" ","Edit", new { EditUser = account.UserName }, new {@class = "icon-1 info-tooltip", @title="Edit"}) %>
                    
                            <% if (account.Role!="Group Admin")
                               { %>
                                    <%: Html.ActionLink(" ","ResetPassword", new { Email = account.Profiles.FirstOrDefault().Email, ReturnUrl = Request.Url.ToString() }, new {onclick="return confirm('Are you sure to reset this user password ?')", @class = "icon-7 info-tooltip", @title="Reset Password"}) %>
                            <% } %>  
                            <%: Html.ActionLink(" ", "EmailNotificationSettings", new { EditUser = account.UserName, ReturnUrl = Request.Url.ToString() }, new { @class = "icon-10 info-tooltip", @title = "EmailNotificationSettings" })%>                 
                            <% if (account.Role!="Group Admin")
                               { %>
                                    <%: Html.ActionLink(" ", "Delete", new { UserName = account.UserName, ReturnUrl = Request.Url.ToString() }, new { onclick = "return confirm('Are you sure to delete this user?')", @class = "icon-2 info-tooltip", @title = "Delete" })%>
                            <% } %>
                    <% } %>
				</td>
			</tr>
         <% } %>
			</table>
			<!--  end product-table................................... --> 
		</div>
		<!--  end content-table  -->
        
		<!--  start paging..................................................... -->
		<table border="0" cellpadding="0" cellspacing="0" id="paging-table">
		<tr>
		<td>
            <div id="PageNavigator">
                <% if (Model.hasPrevious)
                   {
                        %>
                            <%: Html.ActionLink(" ", "Index", new { PageIndex=1 }, new {@class="page-far-left"}) %>
                            <%: Html.ActionLink(" ", "Index", new { PageIndex = Model.PageIndex-1 }, new {@class="page-left"}) %>
                        <% 
                     } %>
                <div class="page-info">Page <strong><%: Model.PageIndex%></strong> / <%: Model.TotalPages %></div>
                <% if (Model.hasNext)
                   {
                        %>
                            <%: Html.ActionLink(" ", "Index", new { PageIndex = Model.PageIndex+1 }, new {@class="page-right"}) %>
                            <%: Html.ActionLink(" ", "Index", new { PageIndex= Model.TotalPages }, new {@class="page-far-right"}) %>
                        <%
                }%>
            </div>
		</td>
		</tr>
		</table>
		<!--  end paging................ -->
		<div class="clear"></div>
	</div>
	<!--  end content-table-inner ............................................END  -->
	</td>
	<td id="tbl-border-right"></td>
</tr>
<tr>
	<th class="sized bottomleft"></th>
	<td id="tbl-border-bottom">&nbsp;</td>
	<th class="sized bottomright"></th>
</tr>
</table>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="Fotter" runat="server">
</asp:Content>
